<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /*
完成函数solution，它的作用是将驼峰风格的变量名变为“连接线风格”

例如
  "camelCasing"  =>  "camel-casing"
  "identifier"   =>  "identifier"
  ""             =>  ""
*/

function solution(string) {
  return string.replace(/[A-Z]/g, function(arg){
    console.log(arg);
    return "-"+ arg.toLowerCase()
  })
}

console.log(solution('camelCasing'))
console.log(solution('camelCasingTest'))
  </script>
</body>
</html>